One of my TAOS customers wants to create a report with a header on each page except the final page. He tried the following code:
set display term(); t=0; b=2; repeat/until t>=100 { if b=page() then {display "Header of all pages except 1st one"; b=b+1; } display t, row(), page(); t=t+1; }
The problem occurs when the PAGE function reports that TAOS is printing on a new page. By this time it's already too late because PAGE( ) increases as soon as there is data for a next page. Anything sent to the output device will be printed after that text. In the above example, the header data is printed after the first line of data.
Any idea on how this can be accomplished (user text before all other data)?
If you use a variable for the header string, then you can change it (the header string) as needed. Try the following example:
display/header head$; display; // Force the dump of the blank // header; head$="This is the header"; // Now fill it in for next time. // Continue with report, next header // will be loaded.
Or, your example will work with a few changes:
set display term(); t=0; b=2; display/header head$; repeat/until t>=100 { display t, row(), page(); t=t+1; head$="Header of all pages except 1st one"; b=b+1; }
I'm working with an integer data type that expands to a Julian date. I need to access this in a choose/record gosub= segment so I can do a WHERE on the date. If I just do the display, TAOS handles the conversion fine, but in a choose/record statement it's not converted. I have a program that converts 3-byte packed MAI dates, but it crashes with this field because it's defined as 4. I've tried using the date( ) function, but it either doesn't work, or I can't see how to make it work. Can you help me?
Yes. Suppose your alias has a field called DATE which is I(4). Your code may look like:
choose/record /gosub=format_line /display=display_line$ my_alias where my_alias.date between first_date and last_date;. . . subroutine format_line { [do things here] display_line$=
+date(my_alias.date: ) + ; }
I am changing a procedure that currently uses a choose/record with variable information in it to a choose/record/form. My question is, how do I load fields in the choose/record/form with variable information, or fields from another Data Dictionary?
Try something like this:
choose/record/gosub=g1/form customer last_name=lastn$ first_name=firstn$;subroutine g1 { if exists(order of customer) then lastn$=customer.last_name+" (*)"; else lastn$=customer.last_name;
if exists(salesman of customer) then firstn$ = first_name + " (*)"; else firstn$=first_name; }
Copyright BASIS International Ltd. All rights reserved. Comments and questions: webmaster@basis.com |